package com.tang.calculator;

import com.tang.calculator.config.Formula;
import com.tang.calculator.context.CalculateContext;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;

@Component
public interface Calculator {

    //仅测试使用
    default BigDecimal execute(String formula) {
        Formula f = new Formula();
        f.setFormula(formula);
        return execute(f);
    }

    public BigDecimal execute(Formula formula);
    public BigDecimal execute(CalculateContext context);
}
